

DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
                             `id` bigint(20) NOT NULL AUTO_INCREMENT,
                             `username` varchar(50) NOT NULL COMMENT '用户名',
                             `password` varchar(32) NOT NULL COMMENT '密码，md5加密存储',
                             `phone` varchar(20) DEFAULT NULL COMMENT '注册手机号',
                             `email` varchar(50) DEFAULT NULL COMMENT '注册邮箱',
                             `created_time` datetime NOT NULL,
                             `updated_time` datetime NOT NULL,
                             `gender` int(1) DEFAULT 1 comment '性别 男1女2无0',
                             `address` varchar(255) DEFAULT NULL,
                             `status` int(11) DEFAULT '0',
                             `file` varchar(255) DEFAULT NULL COMMENT '头像',
                             `description` varchar(255) DEFAULT NULL,
                             `balance` decimal(10,2) DEFAULT '0.00' COMMENT '余额',
                             `verified` varchar(26) DEFAULT 'N',
                             `role_id` int(11) DEFAULT '0' comment '用户角色',
                             PRIMARY KEY (`id`),
                             UNIQUE KEY `username` (`username`) USING BTREE,
                             UNIQUE KEY `phone` (`phone`) USING BTREE,
                             UNIQUE KEY `email` (`email`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=99 DEFAULT CHARSET=utf8 COMMENT='用户表';


# 只存role 不然太乱了 角色和权限的映射在role_perm表
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
                           `id` int(11) NOT NULL AUTO_INCREMENT,
                           `name` varchar(255) DEFAULT NULL,
                           `description` varchar(255) DEFAULT NULL,
                           PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
#
# INSERT INTO `role` VALUES ('1', '管理员', '最高权限');

# 只是存权限的路径和名字
DROP TABLE IF EXISTS `permission`;
CREATE TABLE `permission` (
                                 `id` int(11) NOT NULL AUTO_INCREMENT,
                                 `name` varchar(255) DEFAULT NULL,
                                 `permission` varchar(255) DEFAULT NULL,
                                 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `role_perm`;
CREATE TABLE `role_perm` (
                                `id` int(11) NOT NULL AUTO_INCREMENT,
                                `role_id` int(11) DEFAULT NULL,
                                `permission_id` int(11) DEFAULT NULL,
                                PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=304 DEFAULT CHARSET=utf8;


# name改成url好懂一点
DROP TABLE IF EXISTS `shiro_filter`;
CREATE TABLE `shiro_filter` (
                                   `id` int(11) NOT NULL AUTO_INCREMENT,
                                   `name` varchar(60) DEFAULT NULL comment '页面',
                                   `perms` varchar(60) DEFAULT NULL comment '权限',
                                   PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `indent`;
CREATE TABLE `indent` (
                            `indent_id` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '订单id',
                            `payment` decimal(10,2) DEFAULT null COMMENT '实付金额',
                            `payment_type` int(1) DEFAULT 1 COMMENT '支付类型 1在线支付 2货到付款',
                            `post_fee` decimal(10,2) DEFAULT 10.00 COMMENT '邮费',
                            `status` int(1) DEFAULT 0 COMMENT '状态 0未付款 1已付款 2未发货 3已发货 4交易成功 5交易关闭 6交易失败',
                            `create_time` datetime DEFAULT NULL COMMENT '订单创建时间',
                            `update_time` datetime DEFAULT NULL COMMENT '订单更新时间',
                            `payment_time` datetime DEFAULT NULL COMMENT '付款时间',
                            `consign_time` datetime DEFAULT NULL COMMENT '发货时间',
                            `end_time` datetime DEFAULT NULL COMMENT '交易完成时间',
                            `close_time` datetime DEFAULT NULL COMMENT '交易关闭时间',
                            `shipping_name` varchar(20) DEFAULT '默认物流' COMMENT '物流名称',
                            `shipping_code` varchar(20) DEFAULT '000000' COMMENT '物流单号',
                            `user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
                            `buyer_message` varchar(100) DEFAULT '' COMMENT '买家留言',
                            `buyer_name` varchar(50) DEFAULT NULL COMMENT '买家昵称',
                            `address_id` bigint(20) comment '订单地址',
                            PRIMARY KEY (`indent_id`),
                            KEY `create_time` (`create_time`),
                            KEY `buyer_nick` (`buyer_name`),
                            KEY `status` (`status`),
                            KEY `payment_type` (`payment_type`)
) ENGINE=InnoDB auto_increment=3000 DEFAULT CHARSET=utf8 comment '订单表';


DROP TABLE IF EXISTS `address`;
CREATE TABLE `address` (
                              `address_id` bigint(20) NOT NULL AUTO_INCREMENT,
                              `user_id` bigint(20) DEFAULT NULL,
                              `user_name` varchar(255) DEFAULT NULL,
                              `tel` varchar(255) DEFAULT NULL,
                              `street_name` varchar(100) DEFAULT NULL,
                              `is_default` tinyint(1) DEFAULT NULL comment '是否为默认地址 1是 0否',
                              `created_time` datetime DEFAULT NULL COMMENT '创建时间',
                              `updated_time` datetime DEFAULT NULL COMMENT '更新时间',
                              PRIMARY KEY (`address_id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

DROP TABLE IF EXISTS `item`;
CREATE TABLE `item` (
                           `id` bigint(20) NOT NULL COMMENT '商品id(编号)',
                           `name` varchar(100) DEFAULT NULL COMMENT '商品名',
                           `detail` varchar(600) DEFAULT '' COMMENT '商品详情',
                           `price_sell` decimal(10,2) DEFAULT null COMMENT '商品销售价格',
                           `inventory` int(11) DEFAULT 0 COMMENT '库存数量',
                           `quota` int(11) DEFAULT NULL COMMENT '售卖数量限制',
                           `image` varchar(500) DEFAULT NULL COMMENT '商品图片',
                           `type` bigint(11) DEFAULT NULL COMMENT '所属分类',
                           `status` int(1) DEFAULT '1' COMMENT '商品状态 1正常 0下架 -1损耗',
                           `created_time` datetime DEFAULT NULL COMMENT '创建时间',
                           `updated_time` datetime DEFAULT NULL COMMENT '更新时间',
                           PRIMARY KEY (`id`),
                           KEY `type` (`type`),
                           KEY `status` (`status`),
                           KEY `updated` (`updated_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品表';

INSERT INTO `item` VALUES ('562379', '坚果 Pro 软胶保护套', 'TPU 环保材质、耐磨、耐油、耐久性强', '49.00', '999', '100', 'http://image.smartisanos.cn/resource/902befd5f32a8caf4ca79b55d39ee25a.jpg', '560', '1', '2017-09-05 21:27:54', '2020-11-11 21:29:54');
INSERT INTO `item` VALUES ('605616', '坚果 Pro 钢化玻璃保护膜（前屏用）', '高达 92% 的超强透光率、耐刮花、防指纹', '49.00', '999', '100', 'http://image.smartisanos.cn/resource/30cacf4088f7105d16452c661afd9299.jpg', '560', '1', '2017-09-05 21:27:54', '2020-11-11 21:29:54');
INSERT INTO `item` VALUES ('679532', 'Smartisan 原装快充充电器 18W', '18W 安全快充、支持主流 QC3.0, MTK PE+2.0 快充协议', '59.00', '999', '100', 'http://image.smartisanos.cn/resource/dc53bd870ee64d2053ecc51750ece43a.jpg', '560', '1', '2017-09-05 21:27:54', '2020-11-11 22:31:04');
INSERT INTO `item` VALUES ('679533', 'Smartisan 坚果自拍杆', '通用 3.5 mm 接口、航空铝合金伸缩杆、防过敏硅胶手柄', '69.00', '999', '100', 'http://image.smartisanos.cn/resource/afe5728faa22f4b078b84d9c725c136d.jpg', '560', '1', '2017-09-05 21:27:54', '2020-11-11 21:29:54');
INSERT INTO `item` VALUES ('691300', 'Smartisan 快充移动电源 10000mAh', '10000mAh 双向快充、轻盈便携、高标准安全保护', '199.00', '999', '100', 'http://image.smartisanos.cn/resource/0540778097a009364f2dcbb8c5286451.jpg', '560', '1', '2017-09-05 21:27:54', '2020-11-11 22:22:53');
INSERT INTO `item` VALUES ('738388', 'Smartisan 原装 Type-C 数据线', 'PTC 过温保护、凹形设计、TPE 环保材质', '39.00', '999', '100', 'http://image.smartisanos.cn/resource/c79a73ffc6f8e782160d978f49f543dc.jpg', '560', '1', '2017-09-05 21:27:54', '2020-11-11 22:15:02');
INSERT INTO `item` VALUES ('741524', 'Smartisan S-100 半入耳式线控耳机', '卓越的 14.2mm 发音单元、三按键式线控', '99.00', '999', '100', 'http://image.smartisanos.cn/resource/c98abe89b5a5502ef04c30e751b2bfef.png', '560', '1', '2017-09-05 21:27:54', '2020-11-11 21:29:54');
INSERT INTO `item` VALUES ('816448', '极米无屏电视 CC', '720P 高清分辨率、JBL 音响、两万毫安续航力', '2799.00', '999', '100', 'http://image.smartisanos.cn/resource/41cb562a47d4831e199ed7e2057f3b61.jpg', '560', '1', '2017-09-05 21:27:54', '2020-11-11 21:29:54');
INSERT INTO `item` VALUES ('816753', '《索尼设计，塑造现代》', '索尼全盛时期工业设计作品首次集结成书并引进中国', '259.00', '999', '100', 'http://image.smartisanos.cn/resource/f950d9c27ef21e17374fa212b40d66a9.jpg', '76', '1', '2017-09-05 21:27:54', '2020-11-11 21:29:54');
INSERT INTO `item` VALUES ('830972', '《深泽直人》', '首次面向中国读者介绍其作品', '199.00', '999', '100', 'http://image.smartisanos.cn/resource/5e4e40120d09fb6791f9430f914c6f68.jpg', '560', '1', '2017-09-05 21:27:54', '2020-11-11 21:29:54');
INSERT INTO `item` VALUES ('832739', 'FIIL CARAT 蓝牙运动耳机', '智能计步、磁吸项链式、佩戴舒适不易掉', '499.00', '999', '100', 'http://image.smartisanos.cn/resource/61b4f3de01f00e57a664e648d6ea4721.jpg', '560', '1', '2017-09-05 21:27:54', '2020-11-11 21:29:54');
INSERT INTO `item` VALUES ('844022', 'FIIL CARAT LITE 蓝牙运动耳机', '线控带麦、IP65 防水、磁吸项链式', '299.00', '999', '100', 'http://image.smartisanos.cn/resource/62c1a6988de8071beef4203bedde5144.jpg', '560', '1', '2017-09-05 21:27:54', '2020-11-11 21:29:54');
INSERT INTO `item` VALUES ('847276', 'FIIL Diva Pro 全场景无线降噪耳机', '智能语音交互、高清无损本地存储播放', '1499.00', '999', '100', 'http://image.smartisanos.cn/resource/804b82e4c05516e822667a23ee311f7c.jpg', '560', '1', '2017-09-05 21:27:54', '2018-04-20 22:18:11');
INSERT INTO `item` VALUES ('856645', '三星 Galaxy S4 (I9500) 16G版 星空黑 联通3G手机', '年货特价来袭！三星经典旗舰机！', '1888.00', '999', '100', 'https://i.loli.net/2018/07/13/5b48b58b511dc.jpg', '560', '0', '2017-09-05 21:27:54', '2017-11-06 23:44:32');
INSERT INTO `item` VALUES ('150635087972564', '支付测试商品 IPhone X 全面屏 全面绽放', '此仅为支付测试商品 拍下不会发货', '1.00', '999', '100', 'https://i.loli.net/2018/07/13/5b48ac7766d98.png,https://i.loli.net/2018/07/13/5b48ac9135c5f.png,https://i.loli.net/2018/07/13/5b48ac9c2be6c.png,https://i.loli.net/2018/07/13/5b48aca99c8b6.png,https://i.loli.net/2018/07/13/5b48a7f468bf2.png', '560', '1', '2017-09-05 21:27:54', '2018-07-13 21:59:05');
INSERT INTO `item` VALUES ('150642571432835', '捐赠商品', '您的捐赠将用于本站维护 给您带来更好的体验', '1.00', '999', '100', 'https://i.loli.net/2018/07/13/5b48a7f46be51.png,https://i.loli.net/2018/07/13/5b48a952de430.png', '560', '1', '2017-09-05 21:27:54', '2018-07-13 21:38:52');
INSERT INTO `item` VALUES ('150642571432836', 'Smartisan T恤 伍迪·艾伦出生', '一件内外兼修的舒适T恤', '149.00', '999', '100', 'https://resource.smartisan.com/resource/f96f0879768bc317b74e7cf9e3d96884.jpg,https://resource.smartisan.com/resource/095b46c25f9df5b13ee51f3e512d1e96.jpg,https://resource.smartisan.com/resource/0c9c397c8ac68a2ad327e1da8a5cb7d0.jpg,https://resource.smartisan.com/resource/154b35897ed3c1cb8dc1c7aae7b88f1f.jpg,https://resource.smartisan.com/resource/4a1686f2fde86e0aaac49c92395d4b32.jpg', '1184', '1', '2018-04-18 20:41:41', '2018-04-20 00:21:01');
INSERT INTO `item` VALUES ('150642571432837', '坚果 3 前屏钢化玻璃保护膜', '超强透光率、耐刮花、防指纹', '49.00', '999', '100', 'https://resource.smartisan.com/resource/3a7522290397a9444d7355298248f197.jpg', '560', '1', '2018-04-19 00:34:06', '2018-04-19 23:49:38');
INSERT INTO `item` VALUES ('150642571432838', '坚果 3 绒布国旗保护套', '质感精良、完美贴合、周到防护', '79.00', '999', '100', 'https://resource.smartisan.com/resource/63ea40e5c64db1c6b1d480c48fe01272.jpg,https://resource.smartisan.com/resource/4b8d00ab6ba508a977a475988e0fdb53.jpg,https://resource.smartisan.com/resource/87ea3888491d172b7d7a0e78e4294b4b.jpg,https://resource.smartisan.com/resource/8d30265188ddd1ba05e34f669c5dcf1c.jpg', '560', '1', '2018-04-19 00:35:50', '2018-04-20 00:01:08');
INSERT INTO `item` VALUES ('150642571432839', '坚果 3 TPU 软胶透明保护套', '轻薄透明、完美贴合、TPU 环保材质', '29.00', '999', '100', 'https://resource.smartisan.com/resource/5e4b1feddb13639550849f12f6b2e202.jpg,https://resource.smartisan.com/resource/0477d8b177db197a0b09a18e116b2bca.jpg,https://resource.smartisan.com/resource/b66d7e832339cf240b13a9a91107abdc.jpg,https://resource.smartisan.com/resource/56db3c83cca697572fa8a1df2e3172d7.jpg', '560', '1', '2018-04-19 00:38:07', '2018-04-20 00:02:54');
INSERT INTO `item` VALUES ('150642571432840', 'Smartisan 半入耳式耳机', '经典配色、专业调音、高品质麦克风', '89.00', '999', '100', 'https://resource.smartisan.com/resource/9c1d958f10a811df841298d50e1ca7c0.jpg,https://resource.smartisan.com/resource/afa4ecdb54d7f50d0b6265bbcf31d6c8.jpg,https://resource.smartisan.com/resource/eb1bf1dee365c7855e6b047d8b9c5b1e.jpg,https://resource.smartisan.com/resource/dfcc9fa16ab354a41683959398bff128.jpg', '560', '1', '2018-04-19 00:40:40', '2018-04-20 00:04:41');
INSERT INTO `item` VALUES ('150642571432841', '坚果 3 TPU 软胶保护套', 'TPU 环保材质、完美贴合、周到防护', '49.00', '999', '100', 'https://resource.smartisan.com/resource/b899d9b82c4bc2710492a26af021d484.jpg,https://resource.smartisan.com/resource/bb8859032d6060ccb4e733a2c8e2f51d.jpg,https://resource.smartisan.com/resource/df5b3d3539481eb1c00333a5bc5b60b6.jpg', '560', '1', '2018-04-19 00:43:48', '2018-04-20 00:06:58');
INSERT INTO `item` VALUES ('150642571432842', '坚果 3 \"足迹\"背贴 乐高创始人出生', '1891 年 4 月 7 日', '79.00', '999', '100', 'https://resource.smartisan.com/resource/abb6986430536cd9365352b434f3c568.jpg', '560', '1', '2018-04-19 00:45:14', '2018-04-20 00:08:21');
INSERT INTO `item` VALUES ('150642571432843', '坚果 3', '漂亮得不像实力派', '1999.00', '999', '100', 'https://resource.smartisan.com/resource/718bcecced0df1cd23bbdb9cc1f70b7d.png', '560', '1', '2018-04-19 22:13:31', '2018-07-13 22:03:52');
INSERT INTO `item` VALUES ('150642571432844', '畅呼吸智能空气净化器超级除甲醛版', '购新空净 赠价值 699 元活性炭滤芯', '2999.00', '999', '100', 'https://resource.smartisan.com/resource/71432ad30288fb860a4389881069b874.png', '560', '1', '2018-04-19 22:16:05', '2018-07-13 22:06:58');
INSERT INTO `item` VALUES ('150642571432845', 'Smartisan 帆布鞋', '一双踏实、舒适的帆布鞋', '199.00', '999', '100', 'https://resource.smartisan.com/resource/2f9a0f5f3dedf0ed813622003f1b287b.jpg,https://resource.smartisan.com/resource/0cd8f107c70d002caf902745355e269a.jpg,https://resource.smartisan.com/resource/fa42dcd439e9fb990831f1d21c3f19b8.jpg', '1184', '1', '2018-04-19 22:22:02', '2018-04-20 00:19:39');
INSERT INTO `item` VALUES ('150642571432846', 'Smartisan T恤 任天堂发售“红白机”', '100% 美国 SUPIMA 棉、舒适拉绒质地', '149.00', '999', '100', 'https://resource.smartisan.com/resource/804edf579887b3e1fae4e20a379be5b5.png,https://resource.smartisan.com/resource/6a92fe5ab90b379d5315c0ee2610f467.png,https://resource.smartisan.com/resource/76c811504b910e04c448dda8d47a09c3.png', '1184', '1', '2018-04-19 22:23:39', '2018-04-20 00:23:09');
INSERT INTO `item` VALUES ('150642571432847', 'Smartisan Polo衫 经典款', '一件表里如一的舒适 POLO 衫', '249.00', '999', '100', 'https://resource.smartisan.com/resource/daa975651d6d700c0f886718c520ee19.jpg,https://resource.smartisan.com/resource/8b4884f04835f8de3c33817732fdcb46.jpg,https://resource.smartisan.com/resource/057f6010d6cb7afc964f812093742283.jpg,https://resource.smartisan.com/resource/3cc4b5a1e0a6136eb9725a88d6c1d3be.jpg,https://resource.smartisan.com/resource/f35c053b87dd0e1255be2a8bfa773232.jpg', '1184', '1', '2018-04-19 22:25:41', '2018-04-20 10:51:53');
INSERT INTO `item` VALUES ('150642571432848', 'Smartisan 牛津纺衬衫', '一件无拘无束的舒适衬衫', '199.00', '999', '100', 'https://resource.smartisan.com/resource/a1c53b5f12dd7ef790cadec0eaeaf466.jpg,https://resource.smartisan.com/resource/dccec50aa1480c23a6d62648d2271c0a.jpg,https://resource.smartisan.com/resource/28c798c14b3cc9cfe7100567df6e5999.jpg,https://resource.smartisan.com/resource/da87105789046c13412f6f6a32032df7.jpg,https://resource.smartisan.com/resource/cf9704df83dc6d6ff5404da154388a58.jpg', '1184', '1', '2018-04-19 22:28:11', '2018-04-20 10:53:15');
INSERT INTO `item` VALUES ('150642571432849', 'Smartisan 明信片', '优质卡纸、包装精致、色彩饱满', '9.90', '999', '100', 'https://resource.smartisan.com/resource/3973d009d182d8023bea6250b9a3959e.jpg,https://resource.smartisan.com/resource/1901bf9f58d83978353cf1ec58442cc6.jpg,https://resource.smartisan.com/resource/4e0b690102858fc3013ea650fb1e1a8e.jpg,https://resource.smartisan.com/resource/51765f60367d6e40e4ae6f2b9ce46a91.jpg,https://resource.smartisan.com/resource/5108b5e7448c14e5241b60ba41fafc8e.jpg', '1184', '1', '2018-04-19 22:31:09', '2018-04-21 11:26:31');
INSERT INTO `item` VALUES ('150642571432850', 'ACIL E1 颈挂式蓝牙耳机', '无感佩戴，一切变得简单', '199.00', '999', '100', 'https://resource.smartisan.com/resource/406eddef8808fa5a9be9594d07ef8643.jpg,https://resource.smartisan.com/resource/548de41c48d47232b4ed541c1df57c2f.jpg,https://resource.smartisan.com/resource/aee0949bc33654bc18cedb8cd7dfbcff.jpg', '560', '1', '2018-04-19 22:32:38', '2018-04-20 11:17:31');
INSERT INTO `item` VALUES ('150642571432851', '优点智能 E1 推拉式智能指纹密码锁', '推拉一下，轻松开关', '2699.00', '999', '100', 'https://resource.smartisan.com/resource/7ac3af5a92ad791c2b38bfe1e38ee334.jpg,https://resource.smartisan.com/resource/e37029b8cd3194ad9581de0ee6512acb.jpg,https://resource.smartisan.com/resource/1501eaf68c9771e5599eec45a5f6320a.jpg,https://resource.smartisan.com/resource/a8c6a41637041c576aaa2a5162d2ab56.jpg,https://resource.smartisan.com/resource/3934e0c458922c0049d311b84ddb73e0.jpg', '560', '1', '2018-04-19 22:36:50', '2018-04-20 00:13:44');
INSERT INTO `item` VALUES ('150642571432852', 'FIIL Driifter 脖挂蓝牙耳机', '全天佩戴 抬手就听 HEAC稳连技术', '499.00', '999', '100', 'https://resource.smartisan.com/resource/367d93db1d58f9f3505bc0ec18efaa44.jpg,https://resource.smartisan.com/resource/8ecc94c0f0c4ebc861f06c86789a66e6.jpg,https://resource.smartisan.com/resource/58a2cdb44f722202b05dd09d6fd959de.jpg,https://resource.smartisan.com/resource/2b811a93a2915310f72291e46bd944ad.jpg,https://resource.smartisan.com/resource/8cd011adef99f9734ed974ea9732e6e7.jpg', '560', '1', '2018-06-02 19:43:12', '2018-06-02 19:43:14');




drop table if exists `storage`;
create table `storage`(
    `item_id` BIGINT(20) not null comment '商品id(编号)',
    `item_name` varchar(100) DEFAULT NULL COMMENT '商品名',
    `inventory` int(11) DEFAULT NULL COMMENT '库存数量',
    `inventory_warn` int(11) DEFAULT NULL COMMENT '库存预警数量',
    `price_in` decimal(10,2) DEFAULT '0.00' COMMENT '商品进货价格',
    `manufacturer` varchar(200) default null comment '生产商',
    `sales` int(11) default 0 comment '销售量',
    `purchase` BIGINT default 0 comment '月进货量',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    primary key (`item_id`),
    key `inventory` (inventory),
    key `update_time` (update_time)
)ENGINE=InnoDB auto_increment=3000 DEFAULT CHARSET=utf8 comment '仓储表';


drop table if exists `catalog`;
create table `catalog`(
    `type_id` BIGINT not null comment '分类id',
    `parent_id` bigint(20) DEFAULT NULL COMMENT '父分类ID=0即代表一级根分类',
    `type_name` varchar(100) default null comment '分类名',
    `status` int(1) DEFAULT '1' COMMENT '状态 1启用 0废弃',
    `icon` varchar(255) DEFAULT NULL COMMENT '图标',
    `item_id` varchar(2000) default '' comment '该分类下的商品',
    `detail` varchar(255) DEFAULT NULL COMMENT '分类详情',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    primary key (`type_id`),
    key `type_name` (type_name)
)ENGINE=InnoDB auto_increment=1200 DEFAULT CHARSET=utf8 comment '商品分类表';


BEGIN;
INSERT INTO `catalog` VALUES (1, 1, '官方配件', 1,'https://www.smartisan.com/category/185?type=shop', '562379','详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (2, 1, '耳机', 1, '', '562379','详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (3, 1, '手机充电配件', 1, '', '562379', '详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (4, 1, '自拍杆', 1, '', '562379', '详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (5, 1, '音箱', 1, '', '562379','详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (6, 1, '车载配件', 1, '', '562379','详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (7, 1, '服饰箱包', 1, 'https://www.smartisan.com/category/157', NULL,'详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (8, 7, '服饰', 1,'', '562379','详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (9, 7, '鞋', 1,  '', '562379','详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (10, 7, '箱包', 1,  '', '562379','详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (11, 1, '畅呼吸', 1,  'https://www.smartisan.com/category/296?type=shop', NULL,'详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (12, 11, '生活电器', 1,  '','562379','详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (202, 8, 'T恤', 1,  'https://resource.smartisan.com/resource/d01dcb91b34b26cda7064a3c9bf655c4.png', '562379', '详情1','2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (204, 8, 'POLO衫', 1,  'https://resource.smartisan.com/resource/daa975651d6d700c0f886718c520ee19.jpg', '562379', '详情1','2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (206, 9, '帆布鞋', 1, 'https://resource.smartisan.com/resource/1db1a8bfee3623fded41c9115b5a5335.jpg', '562379', '详情1','2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (207, 10, '拉杆箱', 1,   'https://resource.smartisan.com/resource/9960e83a55544fbf7b046013a6f7f414.jpg', '562379', '详情1','2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (231, 3, '数据线', 1, 'https://resource.smartisan.com/resource/c79a73ffc6f8e782160d978f49f543dc.jpg', '562379', '详情1','2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (232, 3, '充电器', 1,  'https://resource.smartisan.com/resource/dc53bd870ee64d2053ecc51750ece43a.jpg', '562379', '详情1','2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (234, 2, '线控耳机', 1,  'https://resource.smartisan.com/resource/72e4c31e4e623f5c37c6489f6d91efc6.jpg', '562379', '详情1','2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (235, 3, '移动电源', 1,   'https://resource.smartisan.com/resource/afcec520933673b8e03a867e6502f6e0.jpg', '562379', '详情1','2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (236, 4, '自拍杆', 1,  'https://resource.smartisan.com/resource/b9e61c6d93464454fa2e382632e34cee.jpg', '562379', '详情1','2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (238, 6, '车载充电器', 1,   'https://resource.smartisan.com/resource/d4480234a2f24b0ff5acd98288fd902d.jpg', '605616','详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (252, 5, '音箱', 1,  'https://resource.smartisan.com/resource/c44f0ab4da5591fc3d0f82b7ac0f4f65.jpg', '679533', '详情1','2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (292, 10, '包', 1,  'https://resource.smartisan.com/resource/cef4a5433eb95cbdf242d3c1bf5617f8.jpg', '691300', '详情1','2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (297, 12, '空气净化器', 1,  'https://resource.smartisan.com/resource/71432ad30288fb860a4389881069b874.png', '738388','详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
INSERT INTO `catalog` VALUES (298, 12, '生活电器配件', 1,  'https://resource.smartisan.com/resource/4d83d72c5ecc288e8d5ddd9d06b80f99.jpg', '856645','详情1', '2019-07-29 14:01:59', '2019-07-29 14:01:59');
COMMIT;



# drop table if exists `type_item`;
# create table `type_item`
# (
#     `id`          BIGINT not null auto_increment,
#     `type_id`     BIGINT(11) default null comment '分类id',
#     `item_id`     BIGINT(11) default null comment '对应分类的商品',
#     `create_time` datetime      DEFAULT NULL COMMENT '创建时间',
#     `update_time` datetime      DEFAULT NULL COMMENT '更新时间',
#     primary key (`id`),
#     key `type_id` (`type_id`),
#     key `item_id` (`item_id`)
# )ENGINE=InnoDB auto_increment=700 DEFAULT CHARSET=utf8 comment '分类映射表';


drop table if exists `cart`;
create table `cart`(
    `id` BIGINT(20) not null auto_increment,
    `user_id` BIGINT not null,
    `item_id` BIGINT not null,
    `count`   INT default 1 not null comment '商品数量',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
    primary key(`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 comment '购物车表';

drop table if exists `indent_item`;
create table `indent_item`(
                       `id` BIGINT(20) not null auto_increment,
                       `user_id` BIGINT(20) not NULL,
                       `indent_id` BIGINT not null,
                       `item_id` BIGINT not null,
                       `item_name` varchar(100) DEFAULT NULL COMMENT '商品名',
                       `item_type` bigint(11) DEFAULT NULL COMMENT '商品分类id',
                       `price_sell` decimal(10,2) DEFAULT null COMMENT '商品销售价格',
                       `count`   INT default 1 not null comment '商品购买数量',
                       `create_time` datetime DEFAULT NULL COMMENT '创建时间',
                       `update_time` datetime DEFAULT NULL COMMENT '更新时间',
                       primary key(`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 comment '订单商品表';

